home *** CD-ROM | disk | FTP | other *** search
/ A.C.E. 2 / ACE CD 2.iso / FILES / DOCS / AMOSDOC.LHA / AmosHyperBook.dms / in.adf / Manual / ALLIANCE-8 / ALLIANCE-8
Encoding:
Text File  |  1992-03-20  |  29.5 KB  |  859 lines

  1.  
  2. 8: TEXT AND WINDOWS
  3.  
  4. Text Attributes
  5.                        PEN (set colour of text)
  6.  
  7. PEN index
  8. The PEN instruction sets the colour of all the text which will be
  9. displayed in the current window. This colour can be chosen from one up
  10. to 64 different possibilities depending on the gfx mode you're using.
  11. Example:
  12.           PEN 6
  13.  
  14.           =PEN$(n) (change the pen colour using ctrl chrars)
  15.  
  16. a$=PEN$(n)
  17.  
  18. PEN$ returns a special control sequence which changes the pen colour
  19. inside a string. The new pen colour will be automatically assigned
  20. whenever this string is subsequently printed on the screen. Example:
  21.  
  22.         C$=Pen$(2)+"White "+Pen$(6)+"Blue"
  23.         Print C$
  24.  
  25. The string returned by PEN$ is in the format:
  26.  Chr$(27)+"P"+Chr$(48+n)
  27.  
  28.                PAPER (set colour of the text background)
  29.  
  30. PAPER index
  31.  
  32. "index" can be a number between 0-63.
  33.  
  34.                =PAPER$(n) (return a control sequence to
  35.                          set the paper colour)
  36.  
  37. x$=PAPER$(index)
  38.  
  39. PAPER$ returns a character string which automatically changes the
  40. background colour when it's printed on the screen. For example:
  41.  
  42.         Pen 1: C$=Paper$(2)+"White "+Paper$(6)+"Blue"
  43.         Print C$
  44.  
  45.  
  46.                   INVERSE ON/OFF (enter inverse mode)
  47.  
  48. INVERSE ON/OFF
  49.  
  50. The INVERSE command swaps the text and the background colours.
  51.  
  52.                SHADE ON/OFF (shade all subsequent text)
  53.  
  54. SHADE ON/OFF
  55.  
  56. SHADE ON highlights your text by reducing the brightness of the
  57. characters with a mask pattern. The shade of your text can be returned
  58. to normal using SHADE OFF
  59.  
  60.                    UNDER ON/OFF (set underline mode)
  61.  
  62. UNDER ON/OFF
  63.  
  64. UNDER ON underlines your text when it's printed on the screen. UNDER
  65. OFF turns off the mode.
  66.  
  67.                   WRITING (change text writing mode)
  68.  
  69. WRITING w1 [,w2]
  70.  
  71. The WRITING command allows you to change the writing mode used for all
  72. subsequent text operations. This determines precisely how your new text
  73. will be combined with the existing screen data.
  74.  
  75.         w1=0   REPLACE (Default)   Your new text will obliterate
  76.                                    anything underneath it.
  77.         w1=1   OR                  Merges the characters onto the
  78.                                    screen with a logical OR.
  79.         w1=2   XOR                 Chars are combined now with XOR.
  80.  
  81.         w1=3   IGNORE              Printing operations are ignored!
  82.  
  83. The secont number chooses which parts of the text will be printed on
  84. the screen. This option can be omitted if required.
  85.  
  86.         w2=0   Normal       The text is output to the screen along with
  87.                             the background.
  88.         w2=1   Paper        Only the background of the text is drawn on
  89.                             the screen.
  90.         w2=2   Pen          Ignores the paper colour and writes the
  91.                             text on a background of colour zero.
  92.  
  93. Do *NOT* confuse this with GR WRITING!
  94.  
  95. Cursor functions
  96. AMOS includes a range of facilities which let you move cursor to any
  97. part on the screen.
  98.  
  99.                      LOCATE (position the cursor)
  100.  
  101. LOCATE x,y
  102. LOCATE x,         Locate moves the text cursor to the coordinates x,y.
  103. LOCATE ,y         This sets the starting point for all future printing
  104.                   operations. All screen positions are specified using
  105. a special set of text coordinates. These are meadured in units of a
  106. single character relative to the top left corner of the text window.
  107. For instance the coordinates 15,10 refer to a point 10 chars down and
  108. 15 to the right.
  109.  
  110.   If you attempt to print something outside window limits an error will
  111. be generated.
  112.  
  113.   Note that the current screen is always treated as window 0. So you
  114. don't have to actually open a window before using one of these
  115. functions.
  116.  
  117.                    CMOVE (relative cursor movement)
  118.  
  119. CMOVE w,h
  120.  
  121. Moves the cursor a fixed distance away from its present position. If
  122. your cursor was at 10,10, then typing:
  123.  
  124.         CMOVE 5,-5
  125.  
  126. would move the cursor to 15,5. Like LOCATE you can omit either one of
  127. the coordinates as required.
  128.  
  129.                  =AT (return a sequence of ctrl chars
  130.                         to position the cursor)
  131.  
  132. x$=AT(x,y)
  133.  
  134. The AT function allows you to change the position of text directly from
  135. inside a character string. It works by returning a string in the
  136. format:
  137.           Chr$(27)+"X"+Chr$(27)+"Y"+Chr$(48+Y)
  138.  
  139. Whenever this string is printed, the text cursor will be moved to the
  140. coordinates x,y. For example:
  141.  
  142.       A$="This"+At(10,10)+"Is"+At(1,2)+"The Power Of"+At(20,20)+"AMOS!"
  143.       Print A$
  144.  
  145. These AT commands are perfect for hi-score tables as they allow you to
  146. position our text once and for all during your programs initialisation
  147. phase. You can now update the score at the correct point on the screen
  148. using a single print statement. Here's an example:
  149.  
  150.         HI_SCORE$=At(20,10)+"Hi Score "
  151.         SCORE=10000
  152.         Print HI_SCORE$;SCORE
  153.  
  154. Conversion functions
  155. AMOS Basic provides you with four useful functions which readliy enable
  156. you to convert between text and graphics coordinates.
  157.  
  158.            =XTEXT (convert an x coordinate gfx->text format)
  159.            =YTEXT (convert an y coordinate gfx->text format)
  160.  
  161. t=XTEXT(x)
  162. t=YTEXT(y)
  163.  
  164. These functions take normal x/y coordinates and convert them to text
  165. coordinates relative to the current window. If the screen coordinate
  166. lies outside this window then a negative value will be returned. See
  167. EXAMPLE 8.1.
  168.  
  169.          =XGRAPHIC (convert an x coordinate text->gfx format)
  170.          =YGRAPHIC (convert an y coordinate text->gfx format)
  171.  
  172. g=XGRAPHIC(x)
  173. g=XGRAPHIC(y)
  174.  
  175. These functions are effectively the inverse of XTEXT and YTEXT in that
  176. they take a text X (or) Y coordinate ranging from 0 to the width/height
  177. of the current window and convert them to absolute screen coordinates.
  178. See EXAMPLE 8.2
  179.  
  180. Cursor commands
  181. The text cursor serves as a visible starting point of all future text
  182. operations. It's usually displayed as a flashing horizontal bar,
  183. although this may be changed using the SET CURS and CURS OFF commands.
  184.  
  185.   By moving the cursor on the screen, you can position your text
  186. practically anywhere you like. Remember, all coordinate measurements
  187. are taken using TEXT coordinates relative to the current window.
  188.  
  189.                           HOME (cursor home)
  190.  
  191. HOME
  192.  
  193. Moves the text cursor to the top left hand corner of the current window
  194. (coordinates 0,0)
  195.  
  196.                           CDOWN (cursor down)                               93
  197. CDOWN
  198.  
  199. Pushes the text cursor down by a single line.
  200.  
  201.  
  202.  
  203.                  =CDOWN$ (return a Chr$(31) character)
  204. x$=CDOWN$
  205.  
  206. CDOWN$ is a function which returns a special control character which
  207. automatically moves the cursor when it is printed. So Print CDOWN$ is
  208. identical to CDOWN. CDOWN$ allows you to combine several cursor
  209. movements in a single string. For example:
  210.  
  211.         C$="\"+Cdown$
  212.         For A=0 to 20
  213.           Print C$;
  214.         Next A
  215.  
  216.  
  217.                             CUP (cursor up)
  218. CUP
  219.  
  220. Moves the text cursor up a line in the same way that CDOWN moves down.
  221.  
  222.                   =CUP$ (return a Chr$(30) character)
  223. x$=CUP$
  224.  
  225. CUP$ returns a control string which moves the cursor up by a single
  226. character.
  227.  
  228.                           CLEFT (cursor left)
  229. CLEFT
  230.  
  231. Displaces the text cursor one character to the left.
  232.  
  233.               =CLEFT$ (Control string for CLEFT Chr$(29))
  234. x$=CLEFT$
  235.  
  236. Moves the text cursor one character left. Works like =CUP$.
  237.  
  238.                          CRIGHT (cursor right)
  239. CRIGHT
  240.  
  241. Moves cursor one place to the right.
  242.  
  243.        =CRIGHT$ (Generate a Chr$(28) control string for CRIGHT)
  244.  
  245. x$=CRIGHT$
  246.  
  247. Is the opposite of CLEFT$.
  248.  
  249.           XCURS (return the X coordinate of the text cursor)
  250.           YCURS (return the Y coordinate of the text cursor)
  251.  
  252. x=XCURS
  253. y=YCURS
  254.  
  255. XCURS is a variable containing the current X coordinate of the text
  256. cursos (in text format). YCURS holds the Y coordinate of the cursor.
  257.  
  258.                    SET CURS (set text cursor shape)
  259.  
  260. SET CURS L1,L2,L3,L4,L5,L6,L7,L8
  261.  
  262. This instructoin allows you to change the shape of the cursor to
  263. anything you like. The shape is specified by a list of bit-patterns
  264. held in the parameters L1-L8, Each parameter determines the appearance
  265. of the horizontal line of the cursor, numbered from top to bottom.
  266.  
  267.   Every bit represnts a single point in the current cursor line. If
  268. it's set to 1 then the point will be drawn using colour number 3 -
  269. otherwise it will be displayed in the current PAPER colours. Example:
  270.  
  271.         L1=%11111111
  272.         L2=%11111110
  273.         L3=%11111100
  274.         L4=%11111000
  275.         L5=%11110000
  276.         L6=%11100000
  277.         L7=%11000000
  278.         L8=%10000000
  279.         Set Curs L1,L2,L3,L4,L5,L6,L7,L8
  280.  
  281.                CURS ON/OFF (enable/disable text cursor)
  282.  
  283. CURS ON                          makes text cursor visible
  284. CURS OFF                         hides the cursor in current window
  285.  
  286.                      MEMORIZE X/Y (save the X or Y
  287.                     coordinates of the text cursor)
  288. MEMORIZE X
  289. MEMORIZE Y
  290.                The Memorize commands store the current cursor position.
  291.  
  292.                    REMEMBER X/Y (restore the X or Y
  293.                     coordinate of the text cursor)
  294. REMEMBER X
  295. REMEMBER Y
  296.                REMEMBER positions the cursor at the coordinates saved
  297.                by a previous call to MEMORIZE. If MEMORIZE has not been
  298.           used then the coordinates will be set to zero. See EXAMPLE 8.3
  299.  
  300.          CLINE (clear part or all of the current cursor line)
  301.  
  302. CLINE [n]
  303.  
  304. Clears the line on which the cursor is positioned. If n is present then
  305. "n" characters are cleared starting at the current cursor position.
  306.  
  307.           CURS PEN (choose a new colour for the text cursor)
  308.  
  309. CURS PEN n
  310.  
  311. Changes the colour of the text cursor to index number n.
  312.  
  313. Text Input/Output
  314.  
  315.           CENTRE (print a line of text centred on the screen)
  316.  
  317. CENTRE a$
  318.  
  319. Takes a string of characters in a$ and prints it in the centre of the
  320. screen. This text is always output on the current cursor line.
  321.  
  322.         Locate 0,1
  323.         Centre "This is a centered TITLE"
  324.  
  325.                        =TAB$ (print tabulation)
  326.  
  327. x$=TAB$
  328.  
  329. TAB$ returns a control character known as a TAB (Ascii 9). When this
  330. character is printed the text cursor will be immediately moved several
  331. places to the right. The size of this movement can be set using the SET
  332. TAB kommand. As a default, the tab spacing is set to four (4).
  333.  
  334.                     SET TAB (change the tabulation)
  335.  
  336. SET TAB n
  337.  
  338. This specifies the distance the text cursor will move when TAB
  339. character is printed.
  340.  
  341.                         REPEAT$ (repeat string)
  342.  
  343. x$=REPEAT$(a$,n)
  344.  
  345. The REPEAT$ function allows you to print out the same string of
  346. characters several times using a single PRINT statement.
  347.  
  348.   It works by adding a sequenve of control characters into variable X$.
  349. When this string is printed, AMOS simply repeats a$ to the screen n
  350. times. Possible values for n range between 1 and 207. See EXAMPLE 8.4.
  351.  
  352. The format of the control string is:
  353.  
  354.         Chr$(27)+"RO"+A$+Chr$(27)+"R"+Chr$(48+n)
  355.  
  356. Advanced Text Commands
  357.  
  358.              ZONE$ (set up a zone around a piece of text)
  359.  
  360. x$=ZONE$(a$,n)
  361.  
  362. The ZONE$ function surrounds a section of text with a screen zone.
  363. After you have defined one of these zones you can check for coillisions
  364. between the zone and the mouse using the ZONE function. This allows you
  365. to create powerful on-screen menus and dialogue boxes without having to
  366. resort to any complicated programming tricks.
  367.  
  368.   a$ is a string containing the text for one the "Buttons" in your
  369. dialogue box. This button will be activated automatically when you
  370. print x$ to the screen.
  371.  
  372.   n specifies the number of screen zone to be defined. The max. number
  373. of these zones depends on the value you specified with RESERVE ZONE.
  374.  
  375.   See the EXAMPLE 8.5 program in the MANUAL folder. The format of the
  376. control string is:
  377.                    Chr$(27)+"ZO"+A$+Chr$(27)+"R"+Chr$(48+n)
  378.  
  379.                   BORDER$ (add a border to some text)
  380.  
  381. x$=BORDER$(a$,n)
  382.  
  383. This returns a string of control characters which instructs AMOS to
  384. draw a border aound the required text. It's commonly used in
  385. conjunction with the ZONE$ command to produve the fancy buttons found
  386. in dialogue boxes and alert windows.
  387.  
  388.   n is the border number ranging from 1 to 16 and a$ holds the text to
  389. be enclosed by the border. The text in a$ will start at the current
  390. cursor position so don't be surprised when you get strange results
  391. printing at 0,0. To create a screen zone by a border try this:
  392.  
  393.         Print Border$(Zone$(" CLICK HERE ",1),2)
  394.  
  395. This would enclose the text with zone number 1 and border 2. The
  396. control sequence is:
  397.                      Chr$(27)+"EO"+A$+Chr$(27)+"R"+Chr$(48+n)
  398.  
  399.                   HSCROLL (horizontal text scrolling)
  400.  
  401. HSCROLL n
  402.  
  403. This scrolls all the text in the currently open window horizontally by
  404. a single character position. n can take the following values:
  405.  
  406.         1 = Move current line to the left
  407.         2 = Scrolls entire screen to the left
  408.         3 = Move current line to the right
  409.         4 = Move screen to the right
  410.  
  411.                        VSCROLL (vertival scroll)
  412.  
  413. VSCROLL n
  414.  
  415. Scrolls the text in the currently open window vertically.
  416.  
  417.         1 = Any text at the cursor line and below is scrolled down
  418.         2 = Text at cursor line or below is moved up
  419.         3 = Only text from the top of the screen to the cursor line
  420.              is scrolled up
  421.         4 = Text from top of the screen to the current cursor position
  422.              is scrolled down
  423.                                               Blank lines are inserted
  424.                      to pad out the gap left by the scrollingoperation.
  425.  
  426. Windows
  427. The AMOS windowing commands allow you to restrict your text and
  428. graphics operations just a part of the current screen.
  429.  
  430.   AMOS windows can be used with the zone commands to produce effective
  431. dialogue boxes such as file selectors and high score tables. A typical
  432. warning box, for instance, can be easily generated with just a couple
  433. lines of AMOS Basic.
  434.  
  435.                       WINDOPEN (create a window)
  436.  
  437. WINDOPEN n, x, y, w, h [,border [,set]]
  438.  
  439. The WINDOPEN instruction opens a window and displays it on the screen.
  440. This window will now be used for all subsequent text operations.
  441.  
  442.   n is the number of the window to be defined. AMOS allows you to
  443. create as many windows as you like, limited only by the amount of
  444. available memory. As a default, window number zero is assigned to the
  445. current screen. So don't attempt to re-open this window using WINDOPEN
  446. or change it with WIND SIZE or WIND MOVE.
  447.  
  448.   x,y are the graphics coordinates of the top left hand corner of your
  449. new window. Since AMOS windows are drawn using the Amiga's blitter
  450. chip, the window area must always lie on a 16-pixel boundary. In order
  451. to achieve this, the x coordinates are automatically rounded to the
  452. nearest multiple of 16. Additionally, if you've included a border for
  453. your window, the X coordinate will be incremented by a further eight.
  454. This will ensure that the working area of your window always starts at
  455. the correct screen boundary. There are no restrictions whatsoever on
  456. the y coordinates.
  457.  
  458.   w,h specify the size in characters of the new window. These
  459. dimensios must always be divisible by 2.
  460.  
  461.   "border" selects a border style for your window. There are 16
  462. possible styles, with values ranging between 1 and 16.
  463.  
  464.   Window borders can also include up to two optional title lines. One
  465. title is displayed along the top of the window and another may be added
  466. at the bottom.
  467.  
  468.   AMOS windows may contain either text or graphics, just like the
  469. intuition system. Each window can be assigned it's own individual
  470. character set with the powerful WINDOW FONT command. There's also a
  471. powerful WIND SAVE instuction which saves the screen area inside your
  472. windows. Whenever you move one of these windows the contents underneath
  473. will be automatically redrawn. For example:
  474.  
  475.         For W=1 To 3
  476.           Windopen W,(W-1)*96,50,10,101
  477.           Paper W+3 : Pen W+6 : Clw
  478.           Print "Window ";W
  479.         Next W
  480.  
  481. You can flick between these windows using the WINDOW command. Try
  482. typing the following statements from the Direct mode:
  483.  
  484.         Window 1 : Print "AMOS"
  485.         Window 3 : Print "in action!"
  486.         Window 2 : Print "Basic"
  487.  
  488. The active window can always be distinguished by a flashing cursor -
  489. through this can be turned off using the CURS OFF command if required.
  490.  
  491.                    WINDOW FONT (change window font)
  492.  
  493. WINDOW FONT n
  494.  
  495. Changes the font used by the current window to set n. n is the number
  496. of a graphics font which has been previously installed with the GET
  497. FONT command. This font *must* have dimensions of exactly 8x8.
  498. Proportional fonts are not allowed.
  499.  
  500.   Since the window vborders make use of some of these characters, you
  501. may get rather odd results when you're using standard WBench fonts.
  502.  
  503.           WIND SAVE (save the contents of the current window)
  504.  
  505. WIND SAVE
  506.  
  507. The WIND SAVE command allows you to move your windows anywhere on the
  508. screen without corrputing your existing display.
  509.  
  510.   Once you've activated this feature, any windows you subsequently open
  511. will automatically save the entire contents of the windows underneath.
  512. This area will be redrawn whenever you close a window or move it to a
  513. new position.
  514.  
  515.   It's important to note that this option saves the contents of the
  516. current window, rather than the one you are defining with WIND OPEN.
  517.  
  518.   At the start of your program the current window will be the default
  519. screen and will take up a massive 32k of memory. If you wished to save
  520. the background underneath a dialogue box the most of this memory would
  521. be completely wasted.
  522.  
  523.   The solution is to create a dummy window of the required size, and to
  524. position it over the zone you wish to save. You can now execute a WIND
  525. SAVE command and continue with your program as normal.
  526.  
  527.   When you subsequently call up your dialogue box the area underneath
  528. will be saved as part of your dummy window. So it will be automatically
  529. restored after your box has been removed.
  530.  
  531.                BORDER (change the window border of the)
  532.                             current screen)
  533.  
  534. BORDER n,paper,pen
  535.  
  536. The BORDER command sets the border of the current window to style
  537. number n. This border is drawn using a group of characters installed in
  538. the default font. It is therefore possible to create your own border
  539. styles using the font definer accessory.
  540.  
  541.   The paper and pen options allow you to freely choose the colours of
  542. your border. Acceptable border numbers range from 1 to 16.
  543.  
  544.   Any of the parameters may be omitted from this instuction so the
  545. following commands are legal:
  546.  
  547.         BORDER 2,,
  548.         BORDER 2,,3
  549.  
  550.                  TITLE TOP (define the upper title for
  551.                           the current window)
  552.  
  553. TITLE TOP t$
  554.  
  555. This instruction sets the top line of the current window to the title
  556. string in t$. Only bordered windows may be titled in this way.
  557.  
  558.         Windopen 5,1,1,20,10
  559.         Title Top "Window Number 5"
  560.         Wait Key
  561.  
  562.  
  563.  
  564.                TITLE BOTTOM (define the lower title for
  565.                           the current window)
  566.  
  567. TITLE BOTTOM b$
  568.  
  569. This command assigns the string b$ to the bottom title of the current
  570. window.
  571.  
  572.                       WINDOW (change current window)
  573.  
  574. WINDOW n
  575.  
  576. WINDOW activates the window n as the current window. If the automatic
  577. saving system has been initiated, this window be immediately redrawn
  578. along with any of its contents. See EXAMPLE 8.6 in the Manual folder.
  579.  
  580.                =WINDON (Return the value current window)
  581.  
  582. w=WINDOW
  583.  
  584. WINDON returns the identification number of the currently active
  585. window.
  586.  
  587.                  WIND CLOSE (close the current window)
  588.  
  589. WIND CLOSE
  590.  
  591. Deletes the current window. Use the WIND SAVE command if you want the
  592. area that was hidden be redrawn by.
  593.  
  594.                        WIND MOVE (move a window)
  595.  
  596. WINDMOVE x,y
  597.  
  598. Windmove moves the current window to graphics coordinates x,y. As with
  599. the original window definitions the x coordinate will be rounded to the
  600. nearest 16-pixel boundary.
  601.  
  602.            WIND SIZE (change the size of the current window)
  603.  
  604. WIND SIZE sx,sy
  605.  
  606. This command changes the size of an AMOS window. The new sizes, sx and
  607. sy, are specified in units of a single character. Sx must be divisible
  608. by two. See EXAMPLE 8.7.
  609.  
  610.   If you've previously called the WIND SAVE command, the original
  611. contents of your window will be redrawn by this instruction. If the new
  612. window is smaller than the original one, any parts of the image which
  613. lie outside will be lost. Alternatively, if you've expanded your
  614. window, the area around your saved region will be filled with the
  615. current paper colour. Also note that after a WIND SIZE command the text
  616. cursor is always reset to coordinates 0,0.
  617.  
  618.                     CLW (clear the current window)
  619.  
  620. CLW
  621.  
  622. Erases the contents of the current window and fills it with the current
  623. PAPER colour.
  624.  
  625. Slider bars
  626. AMOS incorporates three insturctions which allow you to display a
  627. standard slider bar on the screen. These sliders cannot be manipulated
  628. directly with the mouse. In order to create a working slider bar,
  629. you'll need to write a small Basic routine to perform this operate in
  630. your main program. Due to the sheer power of the AMOS system, this is
  631. extremely easy to accomplish, and the results can be extremely
  632. impressive, as can be seen from EXAMPLE 8.8.
  633.  
  634.                   HSLIDER (draw a horizontal slider)
  635.  
  636. HSLIDER x1,y1 OT x2,y2,total,pos,size
  637.  
  638. Draws a horizontal slider bar from x1,y1 to x2,y2. "total" is the
  639. number of individual units which the slider will be divided into. Each
  640. unit represents a single item in the object you are controlling with
  641. the slider. TSo in the editor window, "total" would be set to the
  642. number of lines in the current program. The size of each unit is
  643. calculated from the following formula:
  644.  
  645.         (X2-X1)/Total
  646.  
  647. "pos" is the position of the slider box from the start of the slider,
  648. measured in the units you specified using "total". "size" is the length
  649. of the slider box in the previous units. See EXAMPLE 8.9.
  650.  
  651.                    VSLIDER (draw a vertical slider)
  652.  
  653. VSLIDER x1,y1 TO x2,y2,total,pos,size
  654.  
  655. VSLIDER is almost identical to the previous HSLIDER insturction. It
  656. displays a simple slider from x1,y1 to x2,y2. See EXAMPLE 8.10.
  657.  
  658.                   SET SLIDER (sets the fill patterns
  659.                            used in a slider)
  660.  
  661. SET SLIDER b1,b2,b3,pb,s1,s2,s3,ps
  662.  
  663. Although this command looks incredibly complicated, it's actually
  664. rather simple. SET SLIDER enters the colours and patterns to be used in
  665. the slider bars created with the H/VSLIDER commands.
  666.  
  667.   "b1,b2,b3" set the ink, paper and outline colours for the background
  668. of the box. "pb" chooses the fill pattern to be used for these regions.
  669.  
  670.   "s1,s2,s3" input the colours of the slider box, and "sp" selects the
  671. pattern it is to be filled with.
  672.  
  673.   "bp" and "sp" can be any fill patterns you wish. As usual, negative
  674. value refer to a sprite image from the current sprite bank. This allows
  675. you to create amazing colorful slider boxes.
  676.  
  677. Fonts
  678. There are two different types of fonts available in AMOS - text fonts
  679. and graphic fonts. The text fonts are those used by the PRINT and
  680. WINDOW commands. Text fonts are known as character sets and each AMOS
  681. Basic window can have its own individual set. The graphic fonts are
  682. much more flexible and offer a wider range of styles:
  683.  
  684. Graphic text
  685. Your Amiga computer is capable of displaying an impressive variety of
  686. different text styles. The original WorkBench disc was supplied with
  687. eight attractive fonts in a range of sizes, and many more of these
  688. fonts are freely available from the public domain. If you've upgraded
  689. to WorkBench 1.3, you'll also be able to design your own fonts using
  690. the FED program on the Extras disc.
  691.  
  692.   AMOS provides you with total support for these fonts. Text can be
  693. printed in any of the available typefaces at any point on the screen.
  694.  
  695.   AMOS fonts can be used to add spice to even the most Basic games.
  696. These are invaluable for producing the loading screens and hi-score
  697. tables in your games. So it's a good idea to make full use of them in
  698. your progs.
  699.  
  700.                       TEXT (print graphical text)
  701.  
  702. TEXT x,y,t$
  703.  
  704. TEXT prints a line of text in t$ at graphical coordinates x,y. All
  705. coordinates are measured relative to the characters baseline. This can
  706. be determined using a special TEXT BASE function.
  707.  
  708.   Normally the baseline is positioned at the bottom of the character,
  709. but some lowercase letters, such as "g", have a "tail" which extends
  710. slightly below this point.
  711.  
  712.   As a default the type styles is set to eight-point Topaz. This may be
  713. changed at any time using the SET FONT instruction. Try the following
  714. program and notice how text can be placed at any pixel position on the
  715. screen.
  716.  
  717.   Do
  718.     Ink Rnd(15)+1,Rnd(15): Text Rnd(320)+1,Rnd(198)+1,"AMOS Basic"
  719.   Loop
  720.  
  721. Al so notice how the colour of your text is set with INK rather than
  722. the expected PEN and PAPER commands. This emphasizes the fact that the
  723. TEXT command is basically a graphical instruction. So the control
  724. sequences created by functions like CUP$ will be printed on the screen
  725. instead of being correctly interpreted.
  726.  
  727.   There is no automatic line feed when the text reaches the end of the
  728. current window. If you attempt to print something too large, the text
  729. will be neatly clipped at the existing screen boundary. This can be
  730. seen by the example below:
  731.  
  732.         Print String$("A",100):Text 0,100,String$("A",100)
  733.  
  734.            GET FONTS (create a list of all available fonts)
  735.  
  736. GET FONTS
  737.  
  738. The GET FONTS command creates an internal list of the all fonts
  739. available from the current start-up disc. This list is essential to the
  740. running of the SET FONT command, so you should always call GET FONTS at
  741. least once before attempting to change the present font setting. The
  742. contents of this list can be examined using the FONT$ function.
  743.  
  744.   WARNING! In order for GET FONTS to work, your current AMOS work disc
  745. must always contain a copy of the standard LIBS folder along with its
  746. contents. It's important to remember this fact when you are
  747. distributing run-only or compiled programs because unless your discs
  748. contain the required files, AMOS Basic will almost certainly crash!
  749.  
  750.            GET DISC FONTS (create a list of the disc fonts)
  751.  
  752. GET DISC FONTS
  753.  
  754. This command is identical to the previous GET FONTS instruction except
  755. that it only searches for fonts on the disc. These fonts are contained
  756. in the FONTS folder on your current boot-disc. If you want to use your
  757. own fonts with AMOS basic, you'll need to copy these onto your normal
  758. start-up disc. See the manual supplied with your Amiga for details of
  759. this procedure.
  760.  
  761.             GET ROM FONTS (create a list of the rom fonts)
  762.  
  763. GET ROM FONTS produces a list of the fonts which are built into Amiga's
  764. rom chips. At the present time there are just two of these fonts:
  765. Eight-point Topaz and nine-point Topaz.
  766.  
  767.            =FONT$ (return details about the available fonts)
  768.  
  769. a$=FONT$(n)
  770.  
  771. Returns a string of 38 chars which describes font number n. This
  772. function allows you to examine the font list created by a previous call
  773. to one of the GET FONT commands.
  774.  
  775.   a$ contains a list of characters which hold the name and type of your
  776. font. If a font does not exist, a$ will be loaded a null value "",
  777. otherwise a string will be returned in the following format:
  778.  
  779.         Character     Description
  780.            1-29       Font name
  781.           30-33       Font height
  782.           34-37       Identifier (set to either Disc or Rom)
  783.  
  784. See EXAMPLE 8.11!
  785.  
  786.                   SET FONT (choose a font for use by
  787.                          the TEXT instruction)
  788.  
  789. SET FONT n
  790.  
  791. SET FONT changes the character set used by the TEXT command to font
  792. number n. If the font is stored on the disc it will be automatically
  793. loaded into your Amiga's memory. At the same time any previously sets
  794. which are not in use will be removed. See EXAMPLE 8.12.
  795.  
  796.                        SET TEXT (set text style)
  797.  
  798. SET TEXT style
  799.  
  800. Allows you to change the style of a font. There are three styles to
  801. choose from. "style" is a bit pattern in the following format:
  802.  
  803.         Bit  Effect
  804.          0   Underline        By setting the appropriate bits in this
  805.          1   Bold             pattern you can choose between a total
  806.          2   Italic           of eight different text styles.
  807.  
  808.               =TEXT STYLE (return the current text style)
  809.  
  810. s=TEXT STYLE
  811.  
  812. This function returns the text style set from the SET TEXT command. The
  813. result in "s" is a bit-map in the same format as that used by SET TEXT.
  814.  
  815.              =TEXT LENGTH (return the length of a section                           of graphic text)
  816.  
  817. w=TEXT LENGTH(t$)
  818.  
  819. The TEXT LENGTH function returns the width in pixels of the character
  820. string a$ in the current font. The width of a character varies
  821. depending on the size of your fonts. In addition, proportional fonts
  822. such as Helvetica assign different widths for each individual
  823. character.
  824.  
  825.                =TEXT BASE (return the current text base)
  826.  
  827. b=TEXT BASE
  828.  
  829. This function returns the position of the baseline of your font. The
  830. baseline is the number of pixels between the top of a character and
  831. point it will be printed on the screen. It's basically similar to the
  832. hot spot of a sprite or bob.
  833.  
  834. Installing new fonts
  835. If you wish to use your own fonts within AMOS Basic, you'll need to
  836. install them onto a copy of your AMOS program disc. The basic procedure
  837. is as follows:
  838.  
  839.  - Copy the required font files into the FONTS: directory of your boot-
  840.    disc.
  841.  - Further information can be found in the Extra's manual supplied with
  842.    the Workbench 1.3 upgrade.
  843.  
  844. Troubleshooting
  845. Problem:  GET FONTS seems to ignore any of the fonts on the current
  846.           disc.
  847. Solution: You've propably removed the original boot disc from your
  848.           default drive. The Amiga's library routines expect to find
  849.           the FONTS: directory on your start-up disc. This can be
  850.           changed using the ASSIGN program in the UTILITIES folder.
  851.  
  852. Problem:  GET FONTS crahes the Amiga completely.
  853. Solution: This problem can easily occur when you're creating programs
  854.           in run-only or compiled format. GET FONTS requires the
  855.           discfont.library in the LIBS folder in order to work.
  856.  
  857. Problem:  The SET FONT command returns a "fonts not examined" error.
  858. Solution: Add a cal to GET FONTS to the start of your program.
  859.